package com.hz.house.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.hz.house.common.ThreadPool;
import com.hz.house.service.BuyHouseFAQService;
import com.hz.house.service.HotQaService;


@Component
public class AllTaskSchduled {

	@Autowired
	private ThreadPool threadPool;
	
	@Autowired
	private HotQaService hotQaService;
	
	@Autowired
	private BuyHouseFAQService buyHouseFAQService;
	
	/**
	 * 	每隔三十秒执行一次，批量跟新涉及到的访问量
	 * */
	@Scheduled(cron = "*/30 * * * * ?")
	public void synVisits() {
		
		//更新今日热问的访问量
		this.threadPool.runInThreadPool(()->{
			this.hotQaService.synHotQaVisit();
		});
		//跟新买房问答的访问量
		this.threadPool.runInThreadPool(()->{
			this.buyHouseFAQService.synFaqLookNums();
		});
	}
}
